package com.example.shoppingcenter.Mapper;

import com.example.shoppingcenter.POJO.Image;
import org.apache.ibatis.annotations.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.util.List;

@Mapper
public interface cdMapper {

    @Insert("INSERT INTO images (user_id,image) VALUES (#{userId},#{imageBlob})")
    int saveImage(@Param("userId") int userId, @Param("imageBlob") byte[] ImageBlob);

    @Select("SELECT * FROM images WHERE user_id = #{userId}")
    List<Image> getImageByUserId(@Param("userId") int userId);

    @Delete("delete from images where id = #{imageId}")
    int deleteImage(@Param("imageId") int imageId);
}
